<template>
  <div class="b">
    B
    {{ opt.name }}
    {{ opt.age }}
  </div>
</template>
<script>
import EventBus from '@/eventBus/index'
export default {
  data() {
    return {
      opt: {},
    }
  },
  created() {
    EventBus.$on('fromAtoB', (res) => {
      // console.log('res:', res)
      // this.opt.name = res.name
      // this.opt.age = res.age
      // 针对后添加的字段
      this.$set(this.opt, 'name', res.name)
      this.$set(this.opt, 'age', res.age)
      console.log(this.opt, 'opt---------')
    })
  },
  mounted() {
    console.log()
  },
}
</script>
<style lang="scss">
.b {
  width: 500px;
  height: 200px;
  margin: 5px;
  border: 1px solid #000;
  border-radius: 10px;
}
</style>
